package com.haidong.service.impl;

import com.haidong.dao.AutoDao;
import com.haidong.service.AutoService;

/**
 * 如果使用自动注入的方式的话,对应的setter不可省略
 */
public class AutoServiceImpl implements AutoService {
    private AutoDao autoDao;
    // 由于被注入的对象必须在IOC容器中,所以自动装配只能注入引用对象
    private int autoNum;
    private String autoStr;

    public void setAutoDao(AutoDao autoDao) {
        this.autoDao = autoDao;
    }

    public void setAutoNum(int autoNum) {
        this.autoNum = autoNum;
    }

    public void setAutoStr(String autoStr) {
        this.autoStr = autoStr;
    }

    @Override
    public void start() {
        System.out.println("service run");
        System.out.println(autoStr + autoNum);
        autoDao.run();
    }
}
